package com.lxh.controller;

import com.lxh.config.utils.FileUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;

/**
 * @ClassName: FileController
 * @Author: lxh
 * @Description: 文件控制器
 * @Date: 2022/5/18 14:53
 */
@RestController
@RequestMapping("/file")
public class FileController {

    @PostMapping("/upload")
    public String upload(MultipartFile file) {
        String filePath = "C:\\eladmin\\avatar\\";
        File file1 = FileUtils.upload(file, filePath);
        assert file1 != null;
        return file1.getPath();
    }

}
